import NameMark from './nameMark'
// 日志
export default {
  // 日志模版
  logTemplate:{
    sect:[
      '潜入{name}禁地，偷得{goods}',
      '进入百年开启的{name}秘境，寻得{goods}',
      '进入十年开启的{name}秘境，寻得{goods}',
      '坠入{name}秘境，大难不死，寻得{goods}',
      '误打误撞破解{name}秘境阵法，进入探寻，获得{goods}',
    ],
    person:[
      '获{name}赏识，赐予{goods}',
      '获得{name}青睐，通过临终考核，传授于{goods}',
      '前辈高人遇难，临死前转赠{goods}',
      '与{name}交流修炼心得，十分开心，临别获赠{goods}',
    ],
    exp:[
      '历练凡尘，心有所感，获得{exp}修为',
      '看破红尘，深有体会，获得{exp}修为',
      '观摩高手对决，有所顿悟，获得{exp}修为',
      '观看天骄对决，有所感悟，获得{exp}修为',
      '进入{sect}秘境历练，有惊无险，获得{exp}修为',
    ],
    mate:[
      '历练凡尘，结识{mate}；日久生情，结为道侣',
      '与{mate}一见钟情，结为道侣',
      '与{mate}结伴历练，情投意合，结为道侣',
      '秘境探险，与{mate}擦枪走火，最终结为道侣',
    ],
    calamityHP:[
      '突破境界，渡劫损失{HP}血量',
    ],
    calamityArms:[
      '突破境界，抵抗雷劫，法宝{arms}完全破损',
    ],
  },

  /**
   * 历练获得功法日志
   * @param date
   * @param val
   * @returns {{timeLine, content: *}}
   */
  generateLiLianSubjectLog(date,val) {
    let rand= Math.floor(Math.random() * 2);
    let template = [];
    if(rand<1){
      template = this.logTemplate.sect
    }else {
      template = this.logTemplate.person
    }
    let keyTwo = Math.floor(Math.random() * template.length);
    let content = template[keyTwo];

    let name = '';
    if(rand<1){
      name = NameMark.generateSectName();
    }else {
      name = NameMark.generateSectName()+'</span><span>'+NameMark.generateJobName();
    }
    // 高亮显示
    name = '<span class="text-success fw-bold">'+name+'</span>'
    val = '<span class="text-success fw-bold">'+val+'</span>'
    // 替换模版中的字符
    content = content.replace('{name}', name);
    content = content.replace('{goods}', val);

  // .replace('sentence', 'message');
    return {timeLine: date, content: content};
  },

  /**
   * 历练获得法宝日志
   * @param date
   * @param val
   * @returns {{timeLine, content: *}}
   */
  generateLiLianArmsLog(date,val) {
    let rand= Math.floor(Math.random() * 2);
    let template = [];
    if(rand<1){
      template = this.logTemplate.sect
    }else {
      template = this.logTemplate.person
    }
    let keyTwo = Math.floor(Math.random() * template.length);
    let content = template[keyTwo];

    let name = '';
    if(rand<1){
      name = NameMark.generateSectName();
    }else {
      name = NameMark.generateSectName()+'</span><span>'+NameMark.generateJobName();
    }
    // 高亮显示
    name = '<span class="text-success fw-bold">'+name+'</span>'
    val = '<span class="text-success fw-bold">'+val+'</span>'
    // 替换模版中的字符
    content = content.replace('{name}', name);
    content = content.replace('{goods}', val);

    return {timeLine: date, content: content};
  },

  /**
   * 历练获得修为日志
   * @param date
   * @param val
   * @returns {{timeLine, content: string}}
   */
  generateLiLianExp(date,val){
    let content = this.logTemplate.exp[Math.floor(Math.random() * this.logTemplate.exp.length)];
    let sect = NameMark.generateSectName();
    // 高亮显示
    sect = '<span class="text-success fw-bold">'+sect+'</span>'
    val = '<span class="text-success fw-bold">'+val+'</span>'
    // 替换模版中的字符
    content = content.replace('{sect}', sect);
    content = content.replace('{exp}', val);
    return {timeLine: date, content: content};
  },

  /**
   * 结识道侣
   * @param date
   * @param val
   * @returns {{timeLine, content: string}}
   */
  generateLiLianMateLog(date,val){
    let content = this.logTemplate.mate[Math.floor(Math.random() * this.logTemplate.mate.length)];
    val = '<span class="text-success fw-bold">'+val+'</span>'
    content = content.replace('{mate}', val);
    return {timeLine: date, content: content};
  },

  /**
   * 雷劫-损失血量
   * @param date
   * @param val
   * @returns {{timeLine, content: string}}
   */
  generateCalamityHP(date,val){
    let content = this.logTemplate.calamityHP[Math.floor(Math.random() * this.logTemplate.calamityHP.length)];
    val = '<span class="text-success fw-bold">'+val+'</span>'
    content = content.replace('{HP}', val);
    return {timeLine: date, content: content};
  },

  /**
   * 雷劫-损失法宝
   * @param date
   * @param val
   * @returns {{timeLine, content: string}}
   */
  generateCalamityArms(date,val){
    let content = this.logTemplate.calamityArms[Math.floor(Math.random() * this.logTemplate.calamityArms.length)];
    val = '<span class="text-success fw-bold">'+val+'</span>'
    content = content.replace('{arms}', val);
    return {timeLine: date, content: content};
  },
}
